/**
 * 
 */
package m10;

import static org.junit.Assert.*;

import org.junit.Test;

import m07.Player;
import m09.Global;

import m09.Trader;

/**
 * @author kateharlan
 * JUnit tests for the 
 *
 */
public class TraderFightTest {

	private static Trader trader;
	
	/**
	 * tests a fight where the trader is weak
	 * and the player is strong.  the player should
	 * win and therefore the money should increase
	 * and so should the fighter points.
	 */
	@Test
	public void testNewWeakTrader() {
		trader = new Trader("trader1", 0, 0, 0, 0);
		Global.currentPlayer = new Player("player!", 0, 0, 0, 0);
		Global.currentPlayer.setFighter(16);
		trader.setFighter(0);
		int origMoney = Global.currentPlayer.getMoney();
		trader.fight();
		assertTrue(origMoney + 100 == Global.currentPlayer.getMoney());
		assertTrue(17 == Global.currentPlayer.getFighter());
	}
	
	/**
	 * tests a fight where teh trader is strong
	 * and the player is weak.  the player should
	 * win and therefore the money should decrease
	 * and the fighter points should not change.
	 */
	@Test
	public void testNewStrongTrader() {
		trader = new Trader("trader1", 0, 0, 0, 0);
		Global.currentPlayer = new Player("player!", 0, 0, 0, 0);
		Global.currentPlayer.setFighter(0);
		trader.setFighter(16);
		int origMoney = Global.currentPlayer.getMoney();
		trader.fight();
		assertTrue(origMoney - 100 == Global.currentPlayer.getMoney());
		assertTrue(0 == Global.currentPlayer.getFighter());
	}

}
